home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{5A65A9C0-089F-11D2-88AD-0000B45C4CF6}#1.2#0"; "EASYX.OCX"
- Begin VB.Form Form1
- Caption = "Form1"
- ClientHeight = 2640
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 2850
- Icon = "Form1.frx":0000
- KeyPreview = -1 'True
- LinkTopic = "Form1"
- ScaleHeight = 2640
- ScaleWidth = 2850
- StartUpPosition = 3 'Windows Default
- Begin VB.Timer Timer1
- Interval = 1
- Left = 240
- Top = 840
- End
- Begin PROJECTEXLibCtl.EasyX EasyX1
- Left = 0
- OleObjectBlob = "Form1.frx":014A
- Top = 0
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Dim Sprite(29) As Long
- Dim SurfaceOne As Long
- Dim BackBuffer As Long
- Const SpriteWidth As Long = 64
- Const SpriteHeight As Long = 64
- 'Ending variable
- Dim Ending As Boolean
- Private Declare Function GetTickCount Lib "kernel32" () As Long
- Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
- Private Sub Form_Load()
- Dim rt As Long
- Dim AppPath As String
- Dim I As Integer, J As Integer
- EasyX1.Window = Me.hWnd
- AppPath = App.Path & "\"
- rt = EasyX1.IWInitDirectDraw(AppPath & "donut.bmp")
- SurfaceOne = EasyX1.LoadBitmapFile(AppPath & "donut.bmp", 0)
- If SurfaceOne <> 0 Then
- MsgBox "surface failed", vbOKOnly
- EasyX1.EndDirectX
- Exit Sub
- End If
- 'create fake back buffer
- BackBuffer = EasyX1.IWCreateFakeBackBuffer(SpriteWidth, SpriteHeight)
- If BackBuffer < 0 Then
- MsgBox "surface failed", vbOKOnly
- EasyX1.EndDirectX
- Exit Sub
- End If
- For I = 1 To 6
- For J = 1 To 5
-
- Sprite((J - 1) + (I - 1) * 5) = EasyX1.MakeSprite( _
- (J - 1) * SpriteWidth, _
- (I - 1) * SpriteHeight, _
- J * SpriteWidth, _
- I * SpriteHeight, SurfaceOne)
- Next J
- Next I
- RunMain
- End Sub
- Private Sub Form_Paint()
- 'Repaint and reload
- EasyX1.IWResetSurfaces
- End Sub
- Private Sub RunMain()
- Dim LastTick As Long
- Dim CurrentTick As Long
- Const TickDifference As Long = 10
- Dim I As Integer
- Me.Show
- CurrentTick = GetTickCount()
-
- If CurrentTick - LastTick > TickDifference And Not Ending Then
- LastTick = CurrentTick
-
-
-
- EasyX1.IWFillSurface 0, BackBuffer
- 'Draw to the fake back buffer
- EasyX1.IWDrawToBackBuffer 0, 0, SpriteWidth, SpriteHeight, Sprite(I), BackBuffer
- 'Flip it
- EasyX1.IWDrawFakeToPrimary BackBuffer
- If I = 29 Then I = 0
- I = I + 1
- ElseIf Ending Then
-
- Exit Do
-
- Else
- DoEvents
- Sleep 10
-
- End If
- DoEvents
- Unload Me
- End Sub
- Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
- Ending = True
- End Sub
-